/*
 *  $Id: Creatures.cs 881 2009-11-24 19:51:45Z thenn.erannor $
 *	This file is a part of Ragima CCG.
 *	(C) 2008 Ragima development group.
 *
 *	Licensed under the terms of the GNU GPL License version 2.
 *
 */

namespace Ragima {
    /// <summary>
    /// Условие на число существ/свободных мест.
    /// Параметры: что требуется (существа или свободные места) и сколько.
    /// </summary>
    public class CreaturesCondition: Condition {
        private bool _free;
        private int _count;

        public CreaturesCondition(bool free, int count) {
            _free = free;
            _count = count;
        }

        public override bool Test(AbstractObject caster, Card card) {
            int a = caster.Owner.GetCreatureCount();
            if (_free) a = Constants.FieldSize - a;
            return a >= _count;
        }

        private static readonly Languages.Phrase NotFree = new Languages.Phrase("condition.creatures.free");
        private static readonly Languages.Phrase NotCreatures = new Languages.Phrase("condition.creatures.creatures");

        public override Languages.Phrase Notice {
            get { return _free ? NotFree : NotCreatures; }
        }
        public override string NoticeText {
            get { return Notice.GetText(_count); }
        }
    }
}